{%include file="header.html"%}
<style>
input {	width: 350px;}
textarea {	width: 350px;	height: 100px;}
    .mark{
        width: 100px;
        height: 100px;
        border: 1px solid #ccc;
        border-radius: 10px;
        box-shadow: 0px 0px 10px 0px #ccc;
    }
    .mark img{
        width: 100%;
    }
</style>
<body>
<div class="fixed-bar">
  <div class="item-title">
    <h3>网站信息设置</h3>
  </div>
</div>
<div class="fixed_bottom">
  <form method="post" action="" id="aspnetForm" name="form1" action="" enctype="multipart/form-data">
    <table cellpadding="0" cellspacing="0" align="center" class="table tb-type2">
      <tbody>
        <tr>
          <td class="firtd"> 网站名称:</td>
          <td><input name="shop_name" type="text" id="web_name" value="{%$name.shop_name%}" placeholder="{%$name.shop_name%}" required/></td>
        </tr>
        <tr>
          <td class="firtd"> 关键词设置:</td>
          <td><input name="shop_keywords" type="text" id="web_keywords" value="{%$name.shop_keywords%}" placeholder="{%$name.shop_keywords%}" required/></td>
        </tr>
        <tr>
          <td class="firtd"> 网站描述:</td>
          <td><input name="shop_desc" type="text" id="web_service" value="{%$name.shop_desc%}" placeholder="{%$name.shop_desc%}" required/></td>
        </tr>
        <tr>
          <td class="firtd"> 所在国家:</td>
          <td>
            <select onchange="get_diqu('country','province')" name="shop_country" id="country">
              <option value="0">=请选择=</option>
                {%foreach $area as $k%}
                {%if $k.parent_id==0%}
                <option value="{%$k.region_id%}" {%if $k.region_id==$address.country.store_range%}selected{%/if%}>{%$k.region_name%}</option>
                {%/if%}
                {%/foreach%}
            </select>
          </td>
        </tr>
        <tr>
          <td class="firtd"> 所在省份:</td>
          <td>
            <select onchange="get_diqu('province','city')" id="province" name="shop_province">
              <option value="0">=请选择=</option>
                {%foreach $area as $k%}
                {%if $k.parent_id==1%}
                <option value="{%$k.region_id%}" {%if $k.region_id==$address.province.store_range%}selected{%/if%}>{%$k.region_name%}</option>
                {%/if%}
                {%/foreach%}
            </select>
          </td>
        </tr>
        <tr>
          <td class="firtd"> 所在城市:</td>
          <td>
            <select id="city" name="shop_city">
              <option value="0">=请选择=</option>
                {%foreach $area as $k%}
                {%if $k.parent_id==$address.province.store_range%}
                <option value="{%$k.region_id%}" {%if $k.region_id==$address.city.store_range%}selected{%/if%}>{%$k.region_name%}</option>
                {%/if%}
                {%/foreach%}
            </select>
          </td>
        </tr>
        <tr>
          <td class="firtd"> 详细地址:</td>
          <td><input name="shop_address" type="text" value="{%$name.shop_address%}" placeholder="{%$name.shop_address%}" required/></td>
        </tr>
        <tr>
          <td class="firtd"> 网站LOGO:</td>
          <td><input type="file" name="shop_logo" onchange="getImgURL(this)"/></td>
        </tr>
        <tr>
            <td class="firtd">
                当前LOGO:
            </td>
            <td>
                <div class="mark">
                    <img data-src="{%$logo%}" src="" alt="">
                </div>
            </td>
        </tr>
        <tr>
          <td class="firtd"> 客服QQ:</td>
          <td><input name="qq" type="text" id="qq" value="{%$name.qq%}" placeholder="{%$name.qq%}"/></td>
        </tr>
        <tr>
          <td class="firtd"> 客服电话:</td>
          <td><input name="service_phone" type="text" id="service_phone" value="{%$name.service_phone%}" placeholder="{%$name.service_phone%}"/></td>
        </tr>
        <tr>
          <td valign="top" class="firtd"> 用户公告:</td>
          <td><textarea name="user_notice" placeholder="{%$name.user_notice%}">{%$name.user_notice%}</textarea></td>
        </tr>
        <tr>
          <td valign="top" class="firtd"> 网店公告:</td>
          <td><textarea name="shop_notice" placeholder="{%$name.shop_notice%}">{%$name.shop_notice%}</textarea></td>
        </tr>
        <tr>
          <td valign="top" class="firtd"> 暂时关闭:</td>
          <td>
            <input style="width: 50px;vertical-align: bottom;" type="radio" name="shop_closed" checked>
            <label for="shop_reg_closed">是</label>
            <input style="width: 50px;vertical-align: bottom;" type="radio" name="shop_closed" >
            <label for="shop_reg_closed">否</label>
          </td>
        </tr>
        <tr>
          <td valign="top" class="firtd"> 关闭说明:</td>
          <td><textarea name="close_comment" placeholder="{%$name.shop_desc%}">{%$name.close_comment%}</textarea></td>
        </tr>
        <tr>
          <td>&nbsp;</td>
          <td><a href="JavaScript:void(0);" class="btn" onclick="$('#submit').click()"><span>确认提交</span></a></td>
          <input type="submit" id="submit" hidden>
        </tr>
      </tbody>
    </table>
  </form>
</div>
<script>
    $(".mark img").attr('src','../'+$(".mark img").data().src);
    function getImgURL(node) {
        var imgURL = "";
        try{
            var file = null;
            if(node.files && node.files[0] ){
                file = node.files[0];
            }else if(node.files && node.files.item(0)) {
                file = node.files.item(0);
            }
            //Firefox 因安全性问题已无法直接通过input[file].value 获取完整的文件路径
            try{
                //Firefox7.0
                imgURL =  file.getAsDataURL();
            }catch(e){
                //Firefox8.0以上
                imgRUL = window.URL.createObjectURL(file);
            }
        }catch(e){
            //支持html5的浏览器,比如高版本的firefox、chrome、ie10
            if (node.files && node.files[0]) {
                var reader = new FileReader();
                reader.onload = function (e) {
                    imgURL = e.target.result;
                };
                reader.readAsDataURL(node.files[0]);
            }
        }
        //imgurl = imgURL;
        creatImg(imgRUL);
        return imgURL;
    }
    function creatImg(imgRUL){
        var textHtml = "<img src='"+imgRUL+"'/>";
        $(".mark").html(textHtml);
    }
</script>
</body>
</html>